import { createRouter, createWebHistory } from "vue-router";
import { useRouter } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/login",
    },

    {
      path: "/admin",
      name: "admin",
      component: () => import("../views/admin/admin_main.vue"),
      children: [
        {
          path: "",
          component: () => import("../views/admin/User.vue"),
        },
        {
          path: "permission",
          component: () => import("../views/admin/Permission.vue"),
        },
        {
          path: "user_manage",
          component: () => import("../views/admin/User.vue"),
        },
        {
          path: "role",
          component: () => import("../views/admin/Role.vue"),
        },
      ],
    },
    {
      path: "/student",
      name: "student",
      component: () => import("../views/student/student_main.vue"),
      // redirect: '/student/ask_leave',
      children: [
        {
          path: "",
          component: () => import("../views/student/answerpaper.vue"),
        },
        {
          path: "ask_leave",
          component: () => import("../views/student/Ask_leave.vue"),
        },
        {
          path: "answerpaper",
          component: () => import("../views/student/answerpaper.vue"),
        },
      ],
    },
    {
      path: "/c_teacher",
      name: "c_teacher",
      component: () => import("../views/c_teacher/c_teacher_main.vue"),
      children: [
        {
          path: "",
          component: () => import("../views/c_teacher/class_manage.vue"),
        },
        {
          path: "examine_leave",
          component: () => import("../views/c_teacher/Examine_leave.vue"),
        },
        {
          path: 'teacher_leave',
          component: () => import("../views/teacher/Ask_for_leave.vue")
        },
        {
          path: "class_manage",
          component: () => import("../views/c_teacher/class_manage.vue"),
        },
        {
          path: "statistics",
          component: () => import("../views/c_teacher/Statistics.vue"),
        },
        {
          path: "breakrule",
          component: () => import("../views/c_teacher/breakrule.vue"),
        },
      ],
    },
    {
      path: "/teacher",
      name: "teacher",
      component: () => import("../views/teacher/teacher_main.vue"),
      children: [
        {
          path: "",
          component: () => import("../views/teacher/class_manage.vue"),
        },
        {
          path: "examine_leave",
          component: () => import("../views/teacher/Examine_leave.vue"),
        },
        {
          path: "class_manage",
          component: () => import("../views/teacher/class_manage.vue"),
        },
        {
          path: "test_question",
          component: () => import("../views/teacher/Test_questions_manage.vue"),
        },
        {
          path: "home",
          component: () => import("../views/teacher/Home.vue")
        },
        {
          path: 'teacher_leave',
          component: () => import("../views/teacher/Ask_for_leave.vue")
        },

        {
          path: "correct_answer",
          component: () => import("../views/teacher/correct_paper.vue"),
        },
        {
          path: "view_paper",
          component: () => import("../views/teacher/view_paper.vue"),
        },
      ],
    },
    {
      path: '/view_result',
      component: () => import("../views/teacher/test_result.vue")
    },
    {
      path: "/dean",
      name: "dean",
      component: () => import("../views/dean/dean_main.vue"),
      children: [
        {
          path: "",
          component: () => import("../views/dean/classes.vue"),
        },
        {
          path: "classes",
          component: () => import("../views/dean/classes.vue"),
        },
        {
          path: "teacher",
          component: () => import("../views/dean/teacher.vue"),
        },
        {
          path: "examination_paper",
          component: () => import("../views/dean/examination_paper_manage.vue"),
        },
        {
          path: "c_teacher",
          component: () => import("../views/dean/c_teacher.vue"),
        },
        {
          path: "examine_leave",
          component: () => import("../views/dean/Examine_leave.vue"),
        },

        {
          path: "syllabus",
          component: () => import("../views/dean/teacher_syllabus.vue"),
        },
        {
          path: "statistics",
          component: () => import("../views/dean/Statistics.vue"),
        },
        {
          path: "breakrule",
          component: () => import("../views/dean/breakrule.vue"),
        },
      ],
    },
    {
      path: "/rector",
      name: "rector",
      component: () => import("../views/rector/rector_main.vue"),
      children: [
        {
          path: "",
          component: () => import("../views/rector/College.vue"),
        },
        {
          path: "examine_leave",
          component: () => import("../views/rector/Examine_leave.vue"),
        },
        {
          path: "college",
          component: () => import("../views/rector/College.vue"),
        },
      ],
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../views/Login.vue"),
    },
    {
      path: "/register",
      name: "register",
      component: () => import("../views/Register.vue"),
    },
    {
      path: "/markheader",
      name: "markheader",
      component: () => import("../views/marketplace/marketplace_header.vue"),
      children: [
        {
          path: "",
          component: () => import("../views/marketplace/Student.vue"),
        },
        {
          path: "student",
          name: "mark_student",
          component: () => import("../views/marketplace/Student.vue"),
        },
      ],
    },
    {
      path: "/edit_oneself",
      name: "edit_oneself",
      component: () => import("../views/Change_oneself.vue"),
    },
    {
      path: "/examination",
      component: () => import("../views/student/examination.vue"),
    },
  ],
});

export default router;
